<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        
        /*
        oop 

        继承  封装  多态/
        */

        // var obj = {
        //     name: '黄诗涵',
        //     ahe: 27,
        //     id: 123,
        //     showId: function() {
        //         alert(this.id);
        //     }
        // }

        // var zhuque = {
        //     name: '王靖凯',
        //     age: 25,
        //     id: 111,
        //     showId: function() {
        //         alert(this.id);
        //     }
        // }

        var huangshihan = teacher('黄诗涵', 27, 111);
        var wangjingkai = teacher('王靖凯', 25, 111);
        console.log(huangshihan);
        wangjingkai.showId();

        console.log(huangshihan.id === wangjingkai.id);


        function teacher(name, age, id) {
            var obj = {};
            obj.name = name;
            obj.age = age;
            obj.id = id;
            obj.showId = function() {
                alert(this.id);
            }
            return obj;
        }

    </script>
</body>
</html>